Skip to content

fix(i18n): stop the parity check passing broken translations or stamping them current - #905

Merged
GeiserX merged 2 commits into
GeiserX:mainfrom
Amigadelasmigas:i18n-check-followup
Nov 28, 2026
Merged

GeiserX merged 2 commits into
GeiserX:mainfrom
Amigadelasmigas:i18n-check-followup

Conversation

@Amigadelasmigas

@Amigadelasmigas Amigadelasmigas commented Nov 27, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

The Desktop and Android lanes copy scripts/i18n_check.py byte for byte, and their reviews found seven cases where the check passed a bad translation or wrote a wrong stamp. This PR fixes all seven. Each fix has a test that fails on the script in main.

  • A placeholder that moved from one select keyword to another passed. Each select keyword now keeps its own placeholder set.
  • Broken braces passed when the English had the same broken braces. A translation with broken braces now always fails.
  • --stamp read the file at the start and compared only its texts before it wrote. An inline source hash that another edit changed in between was overwritten. The comparison now covers the hashes too.
  • --stamp and --restamp gave the current hash to a key that still failed the check. Such a key now keeps its old hash, so it stays stale.
  • The JSON stamp read the file once for the comparison and again for the write. An edit between the two reads got the current hash. It now parses the file once and stamps that same tree. Just before the write it reads the file again, and if the file changed it stops. The other edit stays, and the run fails.
  • The atomic write made the stamped file mode 0600, because mkstemp creates files with that mode. It now keeps the file's mode.
  • In an ICU message, a link inside a plural branch did not count, but the same link outside the branches did. So a translation that moved the link out of the plural failed. An ICU message now checks its links by destination only.

Evidence

  • tests/test_i18n_check.py: 128 passed. The new and changed tests fail against the script at 8a9a10f (8 failed, 120 passed).
  • ruff check and ruff format --check pass (ruff 0.17.6).
  • The 19 catalog locale files from the catalog branch still pass with --strict: 19 targets, 835 source keys, 0 errors, 0 warnings.

Desktop

Desktop and Android copy this script after it merges. Neither of them runs --stamp, ICU messages or inline JSON in CI today.

Type of Change

  • Bug fix

Checklist

  • ruff check and ruff format --check pass (ruff 0.17.6)
  • No credentials or secrets committed
  • CashPilot-Desktop follow-up: the Desktop lane copies the script after the merge (see Desktop above)

… and a stale stamp

The Desktop and Android copies of the check found seven ways it passed or
wrote something it should not:

- a placeholder moved from one select keyword to another passed
- broken braces passed when the English was broken the same way
- --stamp overwrote an inline source hash that changed after the check
- --stamp marked a key current while the key still failed the check
- the stamp read the file twice, so an edit between the reads got stamped
- the atomic write left a stamped file at mode 0600
- a link moved out of an ICU plural failed, the same link inside passed

Each has a test that fails on the old script.
@coderabbitai

coderabbitai Bot commented Nov 27, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 16 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 79e8309 and bfd2dea.

Files selected for processing: 2

  • scripts/i18n_check.py
  • tests/test_i18n_check.py
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@GeiserX GeiserX changed the title fix(i18n): make the parity check fail the seven bad translations the app copies found fix(i18n): stop the parity check passing broken translations or stamping them current Nov 27, 2026
The stamp parsed the file once and wrote the stamped tree, so an edit made
between that read and the write was lost. It now reads the file again just
before the write and refuses when the bytes differ, so the edit stays and
the run fails. The older writer test now passes the full snapshot and has an
unchanged-file control.
@GeiserX
GeiserX merged commit fd093f6 into GeiserX:main Nov 28, 2026
8 of 12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants